package org.komarichin.beans.service;

import org.komarichin.beans.ILanguage;

import java.io.Serializable;
import java.util.Collection;

/**
 * User: Mykhaylo Komarichyn
 * Date: 03.02.2010
 * Time: 14:39:08
 */
public interface ILanguageService<PK> extends Serializable {
    /**
     * save entity
     *
     * @param lang saving entity
     * @return saved entity
     */

    ILanguage<PK> save(ILanguage<PK> lang);

    /**
     * save or update entity
     *
     * @param lang saving or updation entity
     */
    void saveOrUpdate(ILanguage<PK> lang);

    /**
     * @param lang removed entity
     */
    void delete(ILanguage<PK> lang);

    /**
     * @param id identifier removed entity
     */
    void delete(PK id);

    /**
     * @param id finding entity
     * @return found language
     */
    ILanguage<PK> findById(PK id);

    /**
     * @param name finding entity
     * @return found language
     */
    ILanguage<PK> findByName(String name);

    /**
     * @return collection of entities
     */
    Collection<ILanguage<PK>> getAll();

    /**
     * @return new instance of entity
     */
    ILanguage<PK> newInstance();
}
